File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
import type { Metadata } from 'next';
import { notFound, redirect } from 'next/navigation';
import { verifySession } from '@/lib/auth/dal';
import { fetchCommonCodes } from '@/lib/data/repositories/common-code-repository';
import { fetchMerchantDetail } from '@/lib/data/repositories/merchant-detail-repository';
import { fetchMerchantProducts } from '@/lib/data/repositories/merchant-product-repository';
import { CODE_GROUP } from '@/lib/domain/common-code';
import { merchantDetailNewPath } from '@/lib/domain/merchant-detail-query';
import { MerchantDetailForm } from './_components/merchant-detail-form';
export const metadata: Metadata = { title: '가맹몰 상세 정보' };
export const dynamic = 'force-dynamic';
interface PageProps {
params: Promise<{ frcsNo: string }>;
}
/** 수정 화면 — 상세가 있는 가맹점만. 아직 없는 가맹점이면 등록 화면으로 보내 거기서 고르게 한다. */
export default async function Page({ params }: PageProps) {
await verifySession();
const { frcsNo } = await params;
const detail = await fetchMerchantDetail(frcsNo);
if (!detail) {
notFound();
}
if (!detail.hasDetail) {
redirect(merchantDetailNewPath(frcsNo));
}
const [products, categories] = await Promise.all([
fetchMerchantProducts(frcsNo),
fetchCommonCodes(CODE_GROUP.merchantType),
]);
return <MerchantDetailForm detail={detail} products={products} categories={categories} />;
}